package DoublePointSeries;

public class RemoveElementSolution_27_3 {
    public int removeElement(int[] nums, int val) {
        // 设置快慢指针
        int slow = 0;
        for (int fast = 0; fast < nums.length; fast++) {
            // fast 往前移动的时候，遇到val
            if (nums[fast] != val) {
                nums[slow] = nums[fast];
                slow++;
            }
        }
        return slow;
    }
}
